/**
 * type = 1:本次发布; 2:在线数据
 */
import React from 'react'
import PolicyAdd from '../../Strategy/add';
import { Row, Col, Switch } from 'antd'

export default function Com(props) {
  const { value, type } = props
  return (
    <div>
      <Row style={{ marginBottom: 20 }}>
        <div style={{ marginBottom: 20, fontSize: 14 }}>发布信息</div>
        <Row type="flex" gutter={80}>
          <Col>
            <Row type="flex" justify="space-around" gutter={10}>
              <Col>{type === 1 ? '发布方式：' : '运行开始时间：'}</Col>
              <Col>{type === 1 ? (value.effective_time ? `定时发布 ${value.effective_time}` : '立即发布') : value.effective_time}</Col>
            </Row>
          </Col>
          <Col>
            <Row type="flex" justify="space-around" gutter={10}>
              <Col>灰度发布：</Col>
              <Col><Switch checked={value.sample_rate} disabled></Switch></Col>
            </Row>
          </Col>
          {value.sample_rate && <Col>
            <Row type="flex" justify="space-around" gutter={10}>
              <Col>灰度流量占比：</Col>
              <Col>{value.sample_rate + '%'}</Col>
            </Row>
          </Col>}
          <Col>
            <Row type="flex" justify="space-around" gutter={10}>
              <Col>策略版本：</Col>
              <Col>{'V' + value.version}</Col>
            </Row>
          </Col>
        </Row>
      </Row>
      <PolicyAdd
        {...props}
        value={value}
      />
    </div>
  )
}